package com.yswwpp.jsr303;

import java.util.Set;

import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;

public class Main {

	public static void main(String[] agre) {
		try {
			String companyName = null;
			String email = null;
			int count = 10;
			Company company = new Company(companyName, email, count);

			Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
			Set<ConstraintViolation<Company>> set = validator.validate(company);
			for (ConstraintViolation<Company> c : set) {
				System.out.println(c.getPropertyPath() + "" + c.getMessage());
			}

		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}
